package com.diors.game.engine.arpg.fight.attr.object;

import java.util.HashMap;
import java.util.Map;

import com.diors.game.engine.arpg.fight.attr.AttrEnum;

/**
 * 属性对象
 * @author	darren.ouyang <ouyang.darren@gmail.com>
 * @date	2013-10-29
 * @version 1.0
 * @copyright Copyright (c) 2013, darren.ouyang
 */
public class AttrObject 
{
	
	Map<AttrEnum, Integer> attrs;
	
	public AttrObject()
	{
		this.attrs = new HashMap<AttrEnum, Integer>();
	}
	
	/**
	 * 获取属性值
	 * @param attr	属性类型
	 * @return
	 * @create	2013-10-29	darren.ouyang
	 */
	public int getValue (AttrEnum attr)
	{
		Integer value = attrs.get(attr);
		if (value == null)
			return 0;
		
		return value;
	}
	
	/**
	 * 获取属性值（float值）
	 * @param attr	属性类型
	 * @return
	 * @create	2013-10-29	darren.ouyang
	 */
	public float getValueFloat (AttrEnum attr)
	{
		float intValue = (float)getValue(attr);
		float value = intValue / attr.getRatio();
		return value;
	}
	
	
}
